package com.gulimall.member.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gulimall.common.utils.PageUtils;
import com.gulimall.common.utils.Query;
import com.gulimall.member.dao.MemberLoginLogDao;
import com.gulimall.member.entity.MemberLoginLogEntity;
import com.gulimall.member.service.MemberLoginLogService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.Map;


@Service("memberLoginLogService")
public class MemberLoginLogServiceImpl extends ServiceImpl<MemberLoginLogDao, MemberLoginLogEntity> implements MemberLoginLogService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        /**
         * @Description:
         * @Param:
         * @return: 会员id查询
         * @Author: 杨潇淳
         * @Date:
         */
        QueryWrapper<MemberLoginLogEntity> queryWrapper = new QueryWrapper<>();
        String member_id = (String) params.get("member_id");
        if (!StringUtils.isEmpty(member_id)) {
            queryWrapper.like("member_id", member_id);
        }
        IPage<MemberLoginLogEntity> page = this.page(
                new Query<MemberLoginLogEntity>().getPage(params),
                queryWrapper
        );

        return new PageUtils(page);
    }

}